package com.gitee.ixtf.vertx.kotlinx

import cn.hutool.core.io.file.PathUtil
import com.gitee.ixtf.core.kotlinx.extName
import com.gitee.ixtf.core.kotlinx.mainName
import io.vertx.ext.web.FileUpload
import java.nio.file.Path
import kotlin.io.path.Path

fun FileUpload.path(): Path = Path(uploadedFileName())

fun FileUpload.move(path: Path, isOverride: Boolean = true) {
  PathUtil.move(path(), path, isOverride)
}

fun FileUpload.mainName() = fileName().mainName()

fun FileUpload.extName() = fileName().extName()
